﻿<Window x:Class="TeacherLoad.Windows.AcadItems"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TeacherLoad.Windows"
        mc:Ignorable="d"
        Title="Учебные предметы"
        Height="500" Width="900"
        MinHeight="500" MinWidth="900"
        WindowStartupLocation="CenterScreen"
        Background="#BFF7E9">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="320"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="25"/>
        </Grid.RowDefinitions>

        <GroupBox x:Name="HeaderItemAdd"
                  Header="Новая дисциплина"
                  BorderBrush="#200772">
            <StackPanel>
                <Label Content="Наименование дисциплины"/>
                <TextBox x:Name="txItem"
                         TextWrapping="Wrap"
                         Height="70"
                         TextChanged="txItem_TextChanged"
                         VerticalScrollBarVisibility="Auto"/>
                
                <Button x:Name="btnAddItem"
                        Content="Добавить дисциплину"
                        Click="btnAddItem_Click"/>
                <Button x:Name="btnCancelEdit"
                        Content="Отменить редактирование"
                        Visibility="Collapsed"
                        Click="btnCancelEdit_Click"/>
                <Button x:Name="btnClearText"
                        Content="Очистить поле ввода"
                        Visibility="Collapsed"
                        Click="btnClearText_Click"/>
            </StackPanel>
        </GroupBox>

        <GroupBox Grid.Column="1"
                  Header="Список дисциплин">
            <Grid x:Name="DataListItems">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Label Content="Поиск"
                           VerticalAlignment="Center"/>
                    <ComboBox x:Name="cbListItems"
                              Grid.Column="1"
                              ItemsSource="{Binding}" Margin="5, 12" IsEditable="True"
                              SelectionChanged="cbListItems_SelectionChanged"/>
                </Grid>
                <ListBox x:Name="listItem"
                         ItemsSource="{Binding}"
                         SelectionChanged="listItem_SelectionChanged"
                         Grid.Row="1">
                    <ListBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem x:Name="ChangeRow"
                                Header="Изменить дисциплину"
                                Click="ChangeRow_Click"/>
                            <MenuItem x:Name="DoubleRow"
                                      Header="Создать дупликат"
                                      Click="DoubleRow_Click"/>
                        </ContextMenu>
                    </ListBox.ContextMenu>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="WrapWithOverflow" Text="{Binding}" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </GroupBox>
        <StatusBar Grid.Row="1" Grid.ColumnSpan="2"
           Background="#BFF7E9">
            <StatusBarItem>
                <TextBlock Text="{Binding StringFormat=Количество записей: {0},
                            ElementName=listItem, Path=Items.Count}"
                            Margin="5 0"/>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
